<template>
  <div class="sfzView">
    <nav
      style="
        color: #ffffff;
        font-size: 40px;
        width: 100%;
        text-align: center;
        margin-bottom: 150px;
      "
    >
      {{ this.$appName }}
    </nav>
    <div class="contenter">
      <div style="color: #ffffff; font-size: 45px">请输入身份证后九位：</div>
      <el-input
        style="width: 200px"
        maxlength="9"
        minlength="9"
        v-model="idNumber"
      ></el-input>
    </div>
    <button class="btnn" @click="checkExaminerByIdCard">点击验证</button>
    <button class="btnn" @click="clickBack">点击返回人脸识别</button>
  </div>
</template>

<script>
import $api from "../utils/api";
export default {
  data() {
    return {
      idNumber: "", //压力容器
      // idNumber: "005068955",//气瓶充装
    };
  },
  created() {},
  methods: {
    checkExaminerByIdCard() {
      if (!this.idNumber) {
        this.$alert("请输入身份证号后九位", "提示", {
          confirmButtonText: "确定",
          callback: (action) => {},
        });
      }
      let examinerId = JSON.parse(localStorage.getItem("kgId"));
      $api.checkExaminerByIdCard(this.idNumber, examinerId).then((res) => {
        if (res.data.code == "200" && this.idNumber) {
          localStorage.setItem("data", JSON.stringify(res.data.data));
          localStorage.setItem("status", res.data.data.examRecord.status);

          this.$message({
            message: "身份验证成功！",
            type: "success",
            duration: 1000,
          });

          setTimeout(() => {
            if (res.data.data) {
              switch (res.data.data.examRecord.workType) {
                case "R1":
                  this.$router.push({
                    name: "YaLiRongQi",
                  });
                  break;
                case "P":
                  this.$router.push({
                    name: "QiPingChongZhuang",
                  });
                  break;
                case "R3":
                  this.$router.push({
                    name: "YangCangWeiHu",
                  });
                  break;
                case "R2":
                  this.$router.push({
                    name: "YiDongChongZhuang",
                  });
                  break;
                case "Y2":
                  this.$router.push({
                    name: "YouLeChangCaoZuo",
                  });
                  break;
                case "Y1":
                  this.$router.push({
                    name: "YouLeChangXiuLi",
                  });
                  break;
                case "T":
                  this.$router.push({
                    name: "DianTiXiuLi",
                  });
                  break;
                case "G1":
                  this.$router.push({
                    name: "GongYeGuoLu",
                  });
                  break;
                case "S1":
                  this.$router.push({
                    name: "KeYunSuoDaoXiuLi",
                  });
                  break;
                case "S2":
                  this.$router.push({
                    name: "KeYunSuoDaoZuoYe",
                  });
                  break;
                case "Q2(限流动式起重机)":
                  this.$router.push({
                    name: "Q2XianLiuDongShi",
                  });
                  break;
                case "Q2(限桥式起重机)":
                  this.$router.push({
                    name: "Q2XianQiaoShi",
                  });
                  break;
                case "Q2限塔式":
                  this.$router.push({
                    name: "Q2XianTashi",
                  });
                  break;
                case "14":
                  this.$router.push({
                    name: "Q2XianTashi",
                  });
                  break;
                case "Q1":
                  this.$router.push({
                    name: "Q1ZhiHui",
                  });
                  break;
                case "N2":
                  this.$router.push({
                    name: "GuanGuangChe",
                  });
                  break;
                case "F":
                  this.$router.push({
                    name: "AnQuanFaJiaoYan",
                  });
                  break;
                case "G2":
                  this.$router.push({
                    name: "DianZhanGuoLuSiLu",
                  });
                  break;
                case "G3":
                  this.$router.push({
                    name: "GuoLuShuiChuLi",
                  });
                  break;
              }
            }
          }, 1000);
        } else {
          this.$message({
            message: res.data.msg,
            type: "warning",
          });
        }
      });
    },
    clickBack() {
      this.$router.push({
        name: "home",
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.sfzView {
  width: 100vw;
  height: 100vh;
  background-image: url(../assets/keji1.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.contenter {
  display: flex;
  align-items: center;
  margin: 0 auto;
  font-size: 30px;
  width: 700px;
  height: 200px;
  div {
    font-size: 30px;
  }
}
.btnn {
  width: 300px;
  height: 50px;
  border-radius: 10px;
  font-size: 25px;
  margin-top: 20px;
  margin-left: 50%;
  transform: translate(-50%);
  text-align: center;
  background: #efefef;
  line-height: 50px;
}
</style>
